package com.codeoss.framework.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.codeoss.framework.context.UserContext;
import com.codeoss.framework.response.MMyResponse;
import com.codeoss.framework.service.IMMyService;
import com.codeoss.framework.util.LoginLogUtil;
import com.codeoss.module.res.model.ResUser;
import com.codeoss.module.res.service.IResUserService;

@Service
public class MMyService implements IMMyService{
    @Autowired
    private IResUserService resUserService;
    @Autowired
	private LoginLogUtil loginLogUtil;
	@Override
	public MMyResponse init() {
		// TODO Auto-generated method stub
		MMyResponse mMyResponse=new MMyResponse();
		UserContext userContext=UserContext.getCurrentUserContext();
		ResUser resUser=resUserService.getById(userContext.getResUserId());
		mMyResponse.setUserObj(resUser);
		return mMyResponse;
	}
	
	@Override
	public MMyResponse logout() {
		// TODO Auto-generated method stub
		MMyResponse mMyResponse=new MMyResponse();
		loginLogUtil.logLogout();
		return mMyResponse;
	}

}
